package com.akk.module.user.service;

import com.akk.module.user.entity.UserWallet;
import com.akk.module.user.entity.UserWalletExample;
import com.akk.module.user.mapper.UserWalletMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserWalletService {

    @Autowired
    UserWalletMapper userWalletMapper;
    @Autowired
    UserWalletExample userWalletExample;

    public void insert(UserWallet wallet) {
        userWalletMapper.insert(wallet);
    }

    public UserWallet findByUserId(String userId) {
        UserWallet userWallet = userWalletMapper.selectByPrimaryKey(userId);
        return userWallet==null?new UserWallet():userWallet;
    }

    public void update(UserWallet fromWallet) {
        userWalletMapper.updateByPrimaryKey(fromWallet);
    }
}
